"ui";

showLoginUI();
ui.statusBarColor("#000000")

//显示登录界面
function showLoginUI() {
    ui.layout(
        <frame>
            <vertical h="auto" align="center" margin="0 50">
                <linear>
                    <text w="56" gravity="center" color="#111111" size="16">用户名</text>
                    <input id="name" w="*" text="mmdzM52581112D09BF8FAFB17DC5E9F" h="60" />
                </linear>
                <linear>
                    <text w="68" gravity="center" color="#111111" size="16">陌陌名字:</text>
                    <input id="MOMOName" text="雪儿*小雪*小倩" hint="多个名字以*隔开" h="60" />
                </linear>
                <linear>
                    <text w="108" gravity="center" color="#111111" size="16">回复消息3:</text>
                    <input id="nameNewReply3Calls" text="郑州市东方假日酒店*呼和浩特市春雪四季酒店*宁波市开元名都酒店" hint="多条消息以*隔开" h="60" />
                </linear>
                <linear>
                    <text w="56" gravity="center" color="#111111" size="16">平台</text>
                    <input id="names" w="*" text="1" h="60" />
                </linear>
                {/* 
          <linear>
             <text w="86" gravity="center" color="#111111" size="16">涨到买卖最大值全抛</text>
             <input id="BSZmax" w="*" text="10" h="60"/>
          </linear>
          <linear>
             <text w="56" gravity="center" color="#111111" size="16">买份数</text>
             <input id="BSP" w="*" text="10" h="60"/>
          </linear>
          <linear>
             <text w="56" gravity="center" color="#111111" size="16">卖份数</text>
             <input id="SPice" w="*" text="10" h="60"/>
          </linear> */}
                <linear gravity="center">
                    <button id="click_me" text="启动脚本" />
                </linear>
            </vertical>
        </frame>
    );
}


ui.click_me.on("click", () => {
    toast("脚本启动");
    files.createWithDirs("/sdcard/2.txt");
    threads.start(Stazfb);
});
var Text2s, Text1s, LookNum = 0; XmId = 0; shortName = 0; CodeNUm = 0; Site = "";
//StaWbEnd()
function Stazfb() {
    // var 请求地址 = "https://w.eydata.net/3eace7224fc70986";
    // var user = ui.name.getText();
    // //用户名=user

    // var 密码 = "123456";
    // var Version="1.0";
    // var 机器码="";
    // var res = http.post(请求地址, {
    //     "SingleCode": user,
    //     "Ver":"1.0",
    //     "Mac":"111"
    // });
    // //console.log(res.body.string())
    // var a=res.body.string()
    // if(a.length!="32"){
    //console.log(用户名)
    console.log("启点脚本开始");
    Text1s = ui.nameNewReply3Calls.getText();
    launchApp("微信");
    launchApp("MOMO陌陌");
    sleep(5000);
    StaMoMoCler()
    // }else{
    //     console.show();
    //     console.log("卡密错误，请联系管理员获取qq:1934215149");
    // }
}
// var Text2s,Text1s,LookNum=0;XmId=0;shortName=0;CodeNUm=0
// var Site
//StaMoMoCler()
function StaMoMoCler() {
    //launchApp("MOMO陌陌");
    //sleep(6000)
    Text2s = ui.MOMOName.getText();
    console.show()
    try {
        let packageName = "com.immomo.momo";
        app.openAppSetting(packageName);
        console.log(packageName);
        text(app.getAppName(packageName)).waitFor();
        sleep(6000)
        let is_sure = textMatches(/(.*清除.*|.*清除.*|.*清除.*|.*清除.*)/).findOne();
        if (is_sure.enabled()) {
            textMatches(/(.*清除.*|.*清除.*|.*清除.*|.*清除.*)/).findOne().click();
            //textMatches(/(.*清除全部数据.*|.*清除全部数据.*)/).findOne().click();
            textMatches(/(.*确定.*|.*确定.*)/).findOne().click();
            toast(app.getAppName(packageName) + "应用已被清除全部数据");
            sleep(1000);
            back();
            sleep(5000);
            home();
            StaHuaShen()
        }
    } catch (error) {
        log("出现报错，可能陌陌已经卸载")
        Sta360Stop();
    }

}

function StaHuaShen() {
    launch("com.qi.earthnutproxy");
    sleep(6000);
    if (text("跳过 >").exists()) {
        var qchc = text("跳过 >").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(3000)
    }
    if (text("一键更换IP").exists()) {
        var qchc = text("一键更换IP").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(8000)
        if (text("点击断开").exists()) {
            let packageName = "com.miui.miuibbs";
            app.openAppSetting(packageName);
            text(app.getAppName(packageName)).waitFor();
            let is_sure = textMatches(/(.*强.*|.*停.*|.*结.*|.*行.*)/).findOne();
            if (is_sure.enabled()) {
                textMatches(/(.*强.*|.*停.*|.*结.*|.*行.*)/).findOne().click();
                textMatches(/(.*确.*|.*定.*)/).findOne().click();
                toast(app.getAppName(packageName) + "应用已被关闭");
                sleep(1000);
                back();
                sleep(5000);
            }
            launch("com.miui.miuibbs");
            sleep(16000);
            if (desc(" 多开").exists()) {
                var qchc = desc(" 多开").findOne()
                var x = qchc.bounds().centerX();
                var y = qchc.bounds().centerY();
                click(x, y);
                sleep(15800)
                console.hide()
                sleep(1680)
            }
            if (className("android.view.View").depth(8).indexInParent(1).descMatches(/(.*中国.*)/).exists()) {
                var qchc = className("android.view.View").depth(8).indexInParent(1).descMatches(/(.*中国.*)/).findOne()
                var x = qchc.bounds().centerX();
                var y = qchc.bounds().centerY();
                click(x + 58, y);
                sleep(1200)
                console.show()
                sleep(6800)
                log(qchc.desc())
                var a = qchc.desc().split(" ", 20)
                log(a[2])
                Site = a[2]
                sleep(2000)
            } else {
                sleep(3000)
                let packageName = "com.miui.miuibbs";
                app.openAppSetting(packageName);
                text(app.getAppName(packageName)).waitFor();
                let is_sure = textMatches(/(.*强.*|.*停.*|.*结.*|.*行.*)/).findOne();
                if (is_sure.enabled()) {
                    textMatches(/(.*强.*|.*停.*|.*结.*|.*行.*)/).findOne().click();
                    textMatches(/(.*确.*|.*定.*)/).findOne().click();
                    toast(app.getAppName(packageName) + "应用已被关闭");
                    sleep(1000);
                    back();
                    sleep(5000);
                }
                StaHuaShen()
            }
            home()
            sleep(3000)
            StaWeibas()
        } else {
            sleep(8000)
            StaHuaShen()
        }

        //StaRegMoMo()
    }
    sleep(3000)
    StaHuaShen()
}
function StaWeibas(x) {
    let packageName = "com.miui.miuibbs";
    app.openAppSetting(packageName);
    text(app.getAppName(packageName)).waitFor();
    let is_sure = textMatches(/(.*强.*|.*停.*|.*结.*|.*行.*)/).findOne();
    if (is_sure.enabled()) {
        textMatches(/(.*强.*|.*停.*|.*结.*|.*行.*)/).findOne().click();
        textMatches(/(.*确.*|.*定.*)/).findOne().click();
        toast(app.getAppName(packageName) + "应用已被关闭");
        sleep(1000);
        back();
        sleep(5000);
    }
    launch("com.miui.miuibbs");
    sleep(16000);
    if (desc(" 首页").exists()) {
        var qchc = desc(" 首页").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(16000)
    }
    log("抹除APP");
    if (className("android.widget.Button").depth("8").indexInParent(5).exists()) {
        var qchc = className("android.widget.Button").depth("8").indexInParent(5).findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        console.log("抹除APP");
        sleep(5000);
        console.hide();
        setText("信")
        sleep(3000);
        StaClerWM()
    }
    for (let index = 0; index < 2; index++) {
        //一键改机
        if (className("android.widget.Button").depth("8").indexInParent(8).exists()) {
            var qchc = className("android.widget.Button").depth("8").indexInParent(8).findOne()
            var x = qchc.bounds().centerX();
            var y = qchc.bounds().centerY();
            click(x, y);
            sleep(3000)
        }
        if (desc("伪装成新设备").exists()) {
            var qchc = desc("伪装成新设备").findOne()
            var x = qchc.bounds().centerX();
            var y = qchc.bounds().centerY();
            click(x, y);
            sleep(38000)
        }
        if (desc("正在处理...").exists()) {
            sleep(18000)
        }

    }
    StaRegMoMo()
    // if (className("android.widget.Button").depth("8").indexInParent(6).exists()) {
    //     var qchc = className("android.widget.Button").depth("8").indexInParent(6).findOne()
    //     var x = qchc.bounds().centerX();
    //     var y = qchc.bounds().centerY();
    //     click(x, y);
    //     sleep(18000)
    // }
    // console.show();
    // if (descMatches(Site).exists()) {
    //     log(Site+"对比成功")
    //     if (desc(" 完成").exists()) {
    //         var qchc = desc(" 完成").findOne()
    //         var x = qchc.bounds().centerX();
    //         var y = qchc.bounds().centerY();
    //         click(x, y);
    //         sleep(3000)
    //         StaRegMoMo()
    //     }
    //     toast(2)
    // }
    // log("对比失败")
}

//开始注册陌陌
function StaRegMoMo() {
    launch("com.immomo.momo");
    sleep(6000)
    if (text("允许").exists()) {
        var qchc = text("允许").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(8000)
    }
    if (text("同意").exists()) {
        var qchc = text("同意").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(8000)
    }
    if (text("输入手机号码").exists()) {
        log(parseInt(ui.names.getText()))
        if (parseInt(ui.names.getText()) == 1) {
            StaInfoIns()
        } else {
            StaInfoIn()
        }
    }
    if (className("android.widget.ImageView").depth(11).indexInParent(0).exists()) {
        var qchc = className("android.widget.ImageView").depth(11).indexInParent(0).findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(3000)
    }
    if (text("去开启").exists()) {
        var qchc = text("去开启").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(3000)
    }
    if (text("拒绝").exists()) {
        var qchc = text("拒绝").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(3000)
    }
    if (text("拒绝").exists()) {
        var qchc = text("拒绝").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(10000)
        if (text("登录").exists()) {
            home();
            sleep(3000);
            //StaLiuB()
            log(parseInt(ui.names.getText()))
            if (parseInt(ui.names.getText()) == 1) {
                StaInfoIns()
            } else {
                StaInfoIn()
            }
        }
    }
    if (text("登录").exists()) {
        //StaLiuB()
        log(parseInt(ui.names.getText()))
        if (parseInt(ui.names.getText()) == 1) {
            StaInfoIns()
        } else {
            StaInfoIn()
        }

    }
    StaRegMoMo()
}
//短信接口
//StaInfoIn()
function StaInfoIn() {
    console.show()
    var text = http.get("http://129.227.251.50:100/api.php/User/get_project?userAccount=531367159&userPassword=19911214");
    var arr = text.body.string()
    //log(arr)
    var obj = eval('(' + arr + ')');
    //log(obj)
    XmId = obj.data[0].projectId
    log("id为：" + XmId)
    //sleep(1000);
    if (XmId == 1150) {
        log("项目为陌陌，开始执行下一步")
    } else {
        sleep(5000);
        StaInfoIn()
    }
    text = http.get("http://129.227.251.50:100/api.php/User/get_phone?userAccount=531367159&userPassword=19911214&projectId=" + XmId + "&phoneNumber=1");
    arr = text.body.string()
    log(arr)
    var obj = eval('(' + arr + ')');
    //log(obj.data)
    shortName = obj.data.substring(0, 11);
    console.log(shortName);
    if (shortName > 88888) {
        setText(1, shortName)
        sleep(3000);
        log("获取成功：" + shortName)
        StaClick()
    }
    //log(obj)
    var Flag = obj.code
    log("状态为：" + Flag)
    if (Flag == 1007) {
        log("无手机号")
        //sleep(1000);
        StaInfoIn()
    }
    if (Flag == 200) {
        log("获取手机号成功")
        StaGetCode(shortName, XmId)
    } else {
        log("获取错误")
        sleep(5000);
        StaInfoIn()
    }
}

function StaGetCode(phone, Id) {
    var text = http.get("http://129.227.251.50:100/api.php/User/get_sms?userAccount=531367159&userPassword=19911214&phone=" + phone + "&projectId=" + Id);
    var arr = text.body.string()
    log(arr)
    var obj = eval('(' + arr + ')');
    if (obj.code == 200) {
        log(obj.data[0])
        if (obj.data[0] != null) {
            var code = obj.data[0].sms
            setText(code.substring(9, 15))
            log("验证码获取成功" + code.substring(9, 15))
            sleep(6000)
            StaUpdataZL()
        } else {
            log("验证码获取失败" + CodeNUm)
            CodeNUm = CodeNUm + 1
            if (CodeNUm == 12) {
                log("验证码获取失败，换号")
                CodeNUm = 0
                back();
                StaInfoIn()
            }
            StaClick()
            sleep(6800)
            StaGetCode(shortName, XmId)
        }
    } else {
        log("验证码获取失败" + CodeNUm)
        CodeNUm = CodeNUm + 1
        if (CodeNUm == 12) {
            log("验证码获取失败，换号")
            CodeNUm = 0
            back();
            StaInfoIn()
        }
        StaClick()
        sleep(6800)
        StaGetCode(shortName, XmId)
    }
}

//解码2
function StaInfoIns() {
    console.show()
    var text = http.get("http://104.233.169.241/api/AgetInfo?user=531367159&pass=19911214");
    var arr = text.body.string()
    //log(arr)
    var obj = eval('(' + arr + ')');
    //log(obj)
    XmId = obj.auth
    log("id为：" + XmId)
    //sleep(1000);
    if (XmId == 23) {
        log("项目为陌陌，开始执行下一步")
    } else {
        sleep(5000);
        StaInfoIns()
    }
    text = http.get("http://104.233.169.241/api/AgetPhone?user=531367159&pass=19911214&pid=" + XmId);
    arr = text.body.string()
    log(arr)
    var obj = eval('(' + arr + ')');
    var Flag = obj.code
    log("状态为：" + Flag)
    if (Flag == 201) {
        log("无手机号")
        //sleep(1000);
        StaInfoIns()
    }
    //log(obj.data)
    shortName = obj.data.substring(0, 11);
    console.log(shortName);
    if (shortName > 88888) {
        setText(1, shortName)
        sleep(3000);
        log("获取成功：" + shortName)
        StaClick()
    }
    //log(obj)
    if (Flag == 200) {
        log("获取手机号成功")
        StaGetCodes(shortName)
    } else {
        log("获取错误")
        sleep(5000);
        StaInfoIns()
    }
}

function StaGetCodes(phone) {
    var text = http.get("http://104.233.169.241/api/AgetYzm?user=531367159&pass=19911214&phone=" + phone);
    var arr = text.body.string()
    log(arr)
    var obj = eval('(' + arr + ')');
    log(obj.code)
    log(obj.msg)
    if (obj.code == 200) {
        log(obj.data)
        if (obj.data != null) {
            var code = obj.data
            log(code)
            setText(code.substring(9, 15))
            log("验证码获取成功" + code.substring(9, 15))
            sleep(6000)
            StaUpdataZL()
        } else {
            log("验证码获取失败" + CodeNUm)
            CodeNUm = CodeNUm + 1
            if (CodeNUm == 12) {
                log("验证码获取失败，换号")
                CodeNUm = 0
                back();
                StaInfoIns()
            }
            StaClick()
            sleep(6800)
            StaGetCodes(shortName, XmId)
        }
    } else {
        log("验证码获取失败" + CodeNUm)
        CodeNUm = CodeNUm + 1
        if (CodeNUm == 12) {
            log("验证码获取失败，换号")
            CodeNUm = 0
            back();
            StaInfoIns()
        }
        StaClick()
        sleep(6800)
        StaGetCodes(shortName, XmId)
    }
}



//点击
function StaClick() {
    if (text("获取验证码").exists()) {
        var qchc = text("获取验证码").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(2000);
    }
    if (text("去开启").exists()) {
        var qchc = text("去开启").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(3000)
    }
    if (text("拒绝").exists()) {
        var qchc = text("拒绝").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(3000)
    }
    if (text("拒绝").exists()) {
        var qchc = text("拒绝").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(3000)
    }
    if (text("重新获取").exists()) {
        var qchc = text("重新获取").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(2000);
    }
}

//修改资料
function StaUpdataZL() {
    if (text("女生").exists()) {
        var qchc = text("女生").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(3000)
    }
    var a = Text2s.toString().split("*", 20)
    toast(a.length)
    var c = Math.floor(Math.random() * a.length)
    toast(c)
    toast(a[c])
    setText(a[c]);
    // setText(0,"飞雪")
    sleep(3000)
    if (text("选择生日").exists()) {
        var qchc = text("选择生日").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(3000)
        var SjSUm = Math.round(Math.random() * 10 + 30)
        toast(SjSUm)
        for (let index = 0; index < SjSUm; index++) {
            toast(index)
            click(218, 758)
            sleep(200)
            click(418, 758)
            sleep(200)
            click(688, 758)
        }
        click(830, 1288)
        sleep(3000)
    }
    if (text("下一步").exists()) {
        var qchc = text("下一步").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(6000)
    }
    if (text("绑定手机").exists()) {
        back();
        sleep(6000)
    }
    if (text("跳过").exists()) {
        var qchc = text("跳过").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(6000)
        StaSelectImg()
    }
    if (text("立即收听").exists()) {
        back();
        sleep(6000)
    }
    if (text("完成进入").exists()) {
        StaSelectImg()
    }
    if (className("android.widget.ImageView").depth(10).indexInParent(0).exists()) {
        StaSelectImg()
    }
    sleep(3000);
    StaUpdataZL();
}
//设置头像
function StaSelectImg() {
    if (className("android.widget.ImageView").depth(10).indexInParent(0).exists()) {
        var qchc = className("android.widget.ImageView").depth(10).indexInParent(0).findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(3000)
    }
    if (className("android.widget.Button").depth("8").indexInParent(1).text("开启").exists()) {
        var qchc = className("android.widget.Button").depth("8").indexInParent(1).text("开启").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(3000)
    }
    if (text("允许").exists()) {
        var qchc = text("允许").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(3000)
    }
    if (className("android.widget.ImageView").depth(10).indexInParent(0).exists()) {
        var qchc = className("android.widget.ImageView").depth(10).indexInParent(0).findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(3000)
    }
    if (className("android.widget.FrameLayout").depth(11).indexInParent(2).exists()) {
        var qchc = className("android.widget.FrameLayout").depth(11).indexInParent(2).findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(3000)
    }
    if (className("android.widget.Button").depth("8").indexInParent(1).text("确认").exists()) {
        var qchc = className("android.widget.Button").depth("8").indexInParent(1).text("确认").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(3000)
    }
    if (className("android.widget.Button").depth("10").indexInParent(1).text("确认").exists()) {
        var qchc = className("android.widget.Button").depth("10").indexInParent(1).text("确认").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(6000)
    }
    if (className("android.widget.TextView").depth(9).text("完成").exists()) {
        var qchc = className("android.widget.TextView").depth(9).text("完成").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(6000)
    }
    if (className("android.widget.TextView").depth(9).text("完成进入").exists()) {
        var qchc = className("android.widget.TextView").depth(9).text("完成进入").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(3000)
        log("开始获取陌陌号")
        StaSkip();
        //StaUpdataZL()
    }
    if (text("女生").exists()) {
        StaUpdataZL()
    }
    if (text("立即收听").exists()) {
        log("开始获取陌陌号")
        back();
        sleep(6000)
        StaSkip();
    }
    sleep(3000)
    StaSelectImg()
}
//陌陌跳过text = 
function StaSkip() {
    console.hide()
    if (text("绑定手机").exists()) {
        back();
        sleep(6000)
    }
    if (text("跳过").exists()) {
        var qchc = text("跳过").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(6000)
    }
    if (text("拒绝").exists()) {
        var qchc = text("拒绝").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(3000)
    }
    if (text("取消").exists()) {
        var qchc = text("取消").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(3000)
    }
    if (text("跳过").exists()) {
        var qchc = text("跳过").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(6000)
    }
    if (text("立即收听").exists()) {
        back();
        sleep(6000)
    }
    if (text("更多").exists()) {
        var qchc = text("更多").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(6000)
    }
    if (text("查看或编辑个人资料").exists()) {
        var qchc = text("查看或编辑个人资料").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(3000)
    }
    if (text("下次再说").exists()) {
        var qchc = text("下次再说").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(3000)
    }
    swipe(618, 1288, 618, 388, 2000)
    sleep(3000)
    swipe(618, 1288, 618, 388, 2000)
    sleep(3000)
    if (text("Lv1").exists()) {
        var qchc = text("Lv1").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY() + 88;
        press(x, y, 3000)
        toast(1)
        sleep(3000)
    }
    if (text("Lv2").exists()) {
        var qchc = text("Lv2").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY() + 88;
        press(x, y, 3000)
        toast(1)
        sleep(3000)
    }
    if (text("Lv3").exists()) {
        var qchc = text("Lv3").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY() + 88;
        press(x, y, 3000)
        toast(1)
        sleep(3000)
    }
    if (text("Lv4").exists()) {
        var qchc = text("Lv4").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY() + 88;
        press(x, y, 3000)
        toast(1)
        sleep(3000)
    }
    if (text("复制").exists()) {
        var qchc = text("复制").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y)
        toast(1)
        sleep(3000)
        StaWbEnd()
    }
    LookNum = LookNum + 1
    if (LookNum > 5) {
        LookNum = 0
        for (let index = 0; index < 4; index++) {
            swipe(618, 388, 618, 1288, 2000)
            sleep(3000)
        }
    }
    StaSkip()
}

function StaWbEnd() {
    console.show()
    home();
    sleep(3000)
    launch("com.miui.miuibbs");
    sleep(6000);
    if (desc(" 多开").exists()) {
        var qchc = desc(" 多开").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(3000)
    }
    setText(1, getClip())
    sleep(3000)
    setText(1, "")
    sleep(3000)
    setText(1, getClip())
    sleep(3000)
    //保存
    if (className("android.widget.Button").depth("9").indexInParent(5).exists()) {
        var qchc = className("android.widget.Button").depth("9").indexInParent(5).findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(60000)
    }
    if (desc("空 ").exists()) {
        var qchc = desc("空 ").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        log(x)
        sleep(5000)
    }
    if (desc("一键切换").exists()) {
        var qchc = desc("一键切换").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(30000)
        StaDkHuaS();
    }
    StaWbEnd()
}

function StaDkHuaS() {
    launch("com.qi.earthnutproxy");
    sleep(6000);
    if (text("跳过 >").exists()) {
        var qchc = text("跳过 >").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(3000)
    }
    if (text("点击断开").exists()) {
        var qchc = text("点击断开").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(3000)
    }
    StaMoMoCler()
}
//清理微信和陌陌公共（）方法
function StaClerWM() {
    if (desc("微信").exists()) {
        var qchc = desc("微信").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(3000)
    }
    if (desc("确定").exists()) {
        var qchc = desc("确定").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(10000)
        setText("陌陌")
        sleep(3000)
    }
    if (desc("MOMO陌陌").exists()) {
        var qchc = desc("MOMO陌陌").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(6000)
    }
    if (desc("确定").exists()) {
        var qchc = desc("确定").findOne()
        var x = qchc.bounds().centerX();
        var y = qchc.bounds().centerY();
        click(x, y);
        sleep(10000)
        back()
        sleep(3000)
    }
}